#pragma once

#include <windows.h>
#include <Windowsx.h>

// #include "AenoGraphics.hpp"
#include <iostream>
#include <string>
#include <stdio.h>
#include <cstdint>


namespace Aeno
{
    class Color
    {
        public:
            float r,g,b,a;

        public:
            Color();
            ~Color();

        // public:    
            // enum uint32_t // Value : uint32_t
            // {
            //     Black         = 0x000000,
            //     Blue          = 0x0000FF,
            // };

        public:
            Color(float r, float g, float b, float a = 1.0f);
            Color(uint32_t rgb, float a = 1.0f);

        public:
            void setColor(float r, float g, float b, float a = 1.0f);
            void setColor(uint32_t rgb, float a = 1.0f);

    };

    uint32_t RGB_U(uint8_t red, uint8_t green, uint8_t blue);
	uint32_t RGB_C(Color color);
	uint32_t RGB_F(float red, float green, float blue);

	uint32_t RGBA_U(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha);
	uint32_t RGBA_C(Color color);
	uint32_t RGBA_F(float red, float green, float blue, float alpha);



}




// AG hello~
// #include "Color.h"

// Aeno Graphics Api


namespace Aeno
{
    class Renderer
    {
        //public:
        //    Renderer();
        //    ~Renderer();
        //    
        public:

            Renderer(HWND hWnd);

            void ClearScreen();
            void RenderEllipse(int x, int y, int w, int h);
            void SetDeviceContext(HDC hdc);
            void SetClearColor(COLORREF color);
            void Present();

            void UpdateAnimation();
            void SetAnimationSpeed(int speed);
            void SetEllipseSize(int width, int height);

             // 省略其他变量...
            int m_animationX = 0; // 椭圆的水平位置
            int m_animationSpeed = 1; // 动画速度
            int m_ellipseWidth = 300; // 椭圆宽度
            int m_ellipseHeight = 200; // 椭圆高度
            
        private:
            HWND m_hWnd;
            // HDC m_hDC;
            HDC m_hMemDC;
            COLORREF m_clear_color;

           

    };  
}


// Hello 2024
namespace Aeno
{
    struct WindowConfig
    {
        std::string title = "Aeno Windows Platform";
        uint32_t width    = 640;
        uint32_t height   = 480;
        bool resizable    = false;    // 窗口大小可调整
        bool fullscreen   = false;    // 窗口全屏 ok
    };

    class Window
    {
        public:
            Window();
            ~Window();

            static Renderer* s_pRenderer;
            

        public: 
            Window(WindowConfig config);
            void CreateMainWindow();
            bool update();
            
            std::string getTitle();
            void setTitle(std::string title);

            uint32_t getWidth();
            // void setWidth(int width);
            uint32_t getHeight();
            // void setHeight(int height);

            // int getPosX();
            // int getPosY();
            // void setPosX(int x);
            // void setPosY(int y);

            void setFullScreenBool(bool full_screen_bool);
            void setVSyncBool(bool vsync_bool);
            void setFPS(uint32_t fps);
            HWND getHWND();


  

        private:
            static void winControl_(Window* window);
            static LRESULT CALLBACK staticWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
             

        private:
            WindowConfig win_config_;            // ? ok
            HWND         win_handle_;            // ? ok

            uint32_t     width_;                 // ? ok
            uint32_t     height_;                // ? ok
            std::string  title_;                 // ? ok

            int          pos_x_;                 // ? ok
            int          pos_y_;                 // ? ok

            bool         is_vsync_bool_;         // ? ok
            bool         is_fullscreen_bool_;    // ? ok
            bool         is_middle_bool_;        // ? ok
            uint32_t     fps_;

    };

   



}













